import BaseCommand from "@/core/Frame/BaseClass/BaseCommand"

class ZoomToCommand extends BaseCommand {
  viewer: any
  globeControl: any
  globe: any
  constructor(params: any) {
    super()
    this.viewer = params.viewer
    this.globeControl = this.viewer.getGlobeControl()
    this.globe = this.globeControl.getGlobe()
  }

  // 按钮被激活时执行的命令
  execute(option: any) {
    const { paramter, checked } = option
    // 如果此时按钮被选中，则zoom设置为参数给定的级别
    this.globe.setZoom(paramter.zoom)
    this.globe.refresh(false, false)
  }

  // 按钮失活时执行的命令
  release() {
    this.globe.setZoom(3)
    this.globe.refresh(false, false)
  }

  isEnable() {
    return false
  }
}

export default ZoomToCommand